package com.patterns.demo.memento;

/**
 * Author: SamGroves
 * <p>
 * Description:
 * <p>
 * Date: 2017/12/19
 */
public class Original {

    private String value;

    public Original(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    // 存值
    public Memento createMemento() {
        return new Memento(value);
    }

    // 取值
    public void restoreMemento(Memento memento) {
        this.value = memento.getValue();
    }

}
